package com.nineyang.bean;

/**
 * ClassName:PersonBuilder
 * Description:
 * author: jiuyang
 * DateTime: 2025/2/7 下午3:21
 */
public class PersonBuilder {
    private String name;
    private int age;
    private String address;

    private PersonBuilder(String name, int age, String address) {
        this.name = name;
        this.age = age;
        this.address = address;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public String getAddress() {
        return address;
    }

    public static PersonBuliderBulider builder() {
        return new PersonBuliderBulider();
    }

    @Override
    public String toString() {
        return "PersonBuilder{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", address='" + address + '\'' +
                '}';
    }

    // 静态内部类
    public static class PersonBuliderBulider {
        private String name;
        private int age;
        private String address;

        public PersonBuliderBulider name(String name) {
            this.name = name;
            return this;
        }

        public PersonBuliderBulider age(int age) {
            this.age = age;
            return this;
        }

        public PersonBuliderBulider address(String address) {
            this.address = address;
            return this;
        }

        public PersonBuilder build() {
            return new PersonBuilder(name, age, address);
        }
    }


}
